<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }

        .uploader-list {
            margin-left: -15px;
        }

        .uploader-list .info {
            position: relative;
            margin-top: -25px;
            background-color: black;
            color: white;
            filter: alpha(Opacity=80);
            -moz-opacity: 0.5;
            opacity: 0.5;
            width: 100px;
            height: 25px;
            text-align: center;
            display: none;
        }

        .uploader-list .handle {
            position: relative;
            background-color: black;
            color: white;
            filter: alpha(Opacity=80);
            -moz-opacity: 0.5;
            opacity: 0.5;
            width: 120px;
            text-align: right;
            height: 18px;
            margin-bottom: -18px;
            display: none;
        }

        .uploader-list .handle i {
            margin-right: 5px;
        }

        .uploader-list .handle i:hover {
            cursor: pointer;
        }

        .uploader-list .file-iteme {
            margin: 12px 0 0 15px;
            padding: 1px;
            float: left;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item" style="width:800px;">
        <input type="hidden" value="${user.id?default('')}" name="id" id="id"/>
        <label class="layui-form-label required">手机号码</label>
        <div class="layui-input-block">
            <input type="text" name="phone" lay-verify="required" placeholder="" value="${user.phone?default('')}"
                   class="layui-input">
        </div>
    </div>

<!--    <div class="layui-form-item" style="width:800px;">-->
<!--        <label class="layui-form-label required">剪发次数充值</label>-->
<!--        <div class="layui-input-block">-->
<!--            <input type="text" name="chongJianFa" lay-verify="required" placeholder="请输入消费金额(默认为0)" value="0"-->
<!--                   class="layui-input">-->
<!--        </div>-->
<!--    </div>-->

<!--    <div class="layui-form-item" style="width:800px;">-->
<!--        <label class="layui-form-label required">干洗次数充值</label>-->
<!--        <div class="layui-input-block">-->
<!--            <input type="text" name="chongGanXi" lay-verify="required" placeholder="请输入消费金额(默认为0)" value="0"-->
<!--                   class="layui-input">-->
<!--        </div>-->
<!--    </div>-->


<!--    <div class="layui-form-item" style="width:800px;">-->
<!--        <label class="layui-form-label required">洗发次数充值</label>-->
<!--        <div class="layui-input-block">-->
<!--            <input type="text" name="chongXiFa" lay-verify="required" placeholder="请输入消费金额(默认为0)" value="0"-->
<!--                   class="layui-input">-->
<!--        </div>-->
<!--    </div>-->

<!--    <div class="layui-form-item" style="width:800px;">-->
<!--        <label class="layui-form-label">消费项目</label>-->
<!--        <div class="layui-input-block">-->
<!--            <select name="sellState" id="sellState" lay-filter="">-->
<!--            </select>-->
<!--        </div>-->
<!--    </div>-->


<!--    <div class="layui-form-item" style="width:800px;">-->
<!--        <label class="layui-form-label required">消费金额</label>-->
<!--        <div class="layui-input-block">-->
<!--            <input type="text" name="xiaoFeiMoney" lay-verify="required" placeholder="请输入消费金额(默认为0)" value="0"-->
<!--                   class="layui-input">-->
<!--        </div>-->
<!--    </div>-->


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="btn1" id="cancel">取消</button>
        </div>
    </div>
</div>
<!-- 上传图片jquery -->
<script src="../lib/upload/jquery.min.js" charset="utf-8"></script>
<script src="../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="../js/public-config2.js" charset="utf-8"></script>
<!-- 上传图片js -->
<script src="../js/common.js" charset="utf-8"></script>
<script src="../lib/upload/jquery.upload.min.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'upload'], function () {
        var form = layui.form,
            layer = layui.layer,
            upload = layui.upload,
            $ = layui.$;
        $.ajax({
            type: "POST", //提交方式
            url: "../barItem/listNoPage",//路径
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (result) {//返回数据根据结果进行相应的处理
                if (result.code == "0" && result.data) {
                    $("#sellState").html("")
                    var html = '<option value="">请选择</option>';
                    $.each(result.data, function (index, item) {
                        html += '<option value="' + item.id + '">' + item.consumptionItems + '</option>';
                    })
                    $("#sellState").html(html)
                    form.render('select')
                } else {
                    layer.msg(result.msg);
                }
            }
        });
        var iframeIndex = parent.layer.getFrameIndex(window.name);

        // //监听提交
        // form.on('submit(saveBtn)', function (data) {
        //
        //     console.log(data.field.xiaoFeiMoney)
        //     console.log(data.field.sellState)
        //     if (data.field.xiaoFeiMoney !== '0') {
        //         if (data.field.sellState === '') {
        //             layer.msg("请选择消费种类")
        //             return;
        //         }
        //     }
        //     $.ajax({
        //         type: "POST", //提交方式
        //         url: "../chongzhilog/save",//路径
        //         contentType: "application/json;charset=utf-8",
        //         data: JSON.stringify(data.field),//数据，这里使用的是Json格式进行传输
        //         dataType: "json",
        //         success: function (result) {//返回数据根据结果进行相应的处理
        //             if (result.code == "200") {
        //                 var index = layer.msg(result.msg, {
        //                     time: 1000, //如果不配置，默认是3秒）
        //                 }, function () {
        //                     // 关闭弹出层
        //                     layer.close(index);
        //                     parent.layer.close(iframeIndex);
        //                 })
        //             } else {
        //                 layer.msg(result.msg);
        //             }
        //         }
        //     });
        //     return false;
        // });
        $('#cancel').on("click", function () {
            parent.layer.close(iframeIndex);
        });


        //监听提交
        form.on('submit(saveBtn)', function (data) {
            data.field.addMember = localStorage.getItem("memberId");
            $.ajax({
                type: "POST", //提交方式
                url: "update",//路径
                contentType: "application/json;charset=utf-8",
                data: JSON.stringify(data.field),//数据，这里使用的是Json格式进行传输
                dataType: "json",
                success: function (result) {//返回数据根据结果进行相应的处理
                    if (result.code == "200") {
                        var index = layer.msg("修改成功", {
                            time: 200, //如果不配置，默认是3秒）
                        }, function () {
                            // 关闭弹出层
                            layer.close(index);
                            parent.layer.close(iframeIndex);
                            //window.location = "../";
                        })
                    } else {
                        layer.msg(result.msg);
                    }
                }
            });
            return false;
        });


    });
</script>
</body>
</html>